﻿
Imports System
Imports System.Data.Objects
Imports System.Data.EntityClient
Imports IETracker.Business.Entities

Partial Public Class IETrackerDataContext
    Inherits ObjectContext
    Public Const SettingsConnectionString As String = "name=IncomeExpenseEntities"
    Public Const ContainerName As String = "IncomeExpenseEntities"

#Region "Constructors"

    Public Sub New()
        MyBase.New(SettingsConnectionString, ContainerName)
        MyBase.ContextOptions.LazyLoadingEnabled = True
        MyBase.ContextOptions.ProxyCreationEnabled = False
    End Sub

    Public Sub New(ByVal connectionString As String)
        MyBase.New(connectionString, ContainerName)
        MyBase.ContextOptions.LazyLoadingEnabled = True
        MyBase.ContextOptions.ProxyCreationEnabled = False
    End Sub

    Public Sub New(ByVal connection As EntityConnection)
        MyBase.New(connection, ContainerName)
        MyBase.ContextOptions.LazyLoadingEnabled = True
        MyBase.ContextOptions.ProxyCreationEnabled = False
    End Sub

#End Region
#Region "ObjectSet Properties"

    Public ReadOnly Property Petrols() As ObjectSet(Of Petrol)
        Get
            If _petrols Is Nothing Then
                _petrols = CreateObjectSet(Of Petrol)("Petrols")
            End If
            Return _petrols
        End Get
    End Property
    Private _petrols As ObjectSet(Of Petrol)

    Public ReadOnly Property TransactionDescriptions() As ObjectSet(Of TransactionDescription)
        Get
            If _transactionDescriptions Is Nothing Then
                _transactionDescriptions = CreateObjectSet(Of TransactionDescription)("TransactionDescriptions")
            End If
            Return _transactionDescriptions
        End Get
    End Property
    Private _transactionDescriptions As ObjectSet(Of TransactionDescription)

    Public ReadOnly Property Transactions() As ObjectSet(Of Transaction)
        Get
            If _transactions Is Nothing Then
                _transactions = CreateObjectSet(Of Transaction)("Transactions")
            End If
            Return _transactions
        End Get
    End Property
    Private _transactions As ObjectSet(Of Transaction)

    Public ReadOnly Property TransactionTypes() As ObjectSet(Of TransactionType)
        Get
            If _transactionTypes Is Nothing Then
                _transactionTypes = CreateObjectSet(Of TransactionType)("TransactionTypes")
            End If
            Return _transactionTypes
        End Get
    End Property
    Private _transactionTypes As ObjectSet(Of TransactionType)

    Public ReadOnly Property TransactionTypeDescriptions() As ObjectSet(Of TransactionTypeDescription)
        Get
            If _transactionTypeDescriptions Is Nothing Then
                _transactionTypeDescriptions = CreateObjectSet(Of TransactionTypeDescription)("TransactionTypeDescriptions")
            End If
            Return _transactionTypeDescriptions
        End Get
    End Property
    Private _transactionTypeDescriptions As ObjectSet(Of TransactionTypeDescription)

    Public ReadOnly Property Vehicles() As ObjectSet(Of Vehicle)
        Get
            If _vehicles Is Nothing Then
                _vehicles = CreateObjectSet(Of Vehicle)("Vehicles")
            End If
            Return _vehicles
        End Get
    End Property
    Private _vehicles As ObjectSet(Of Vehicle)

#End Region
End Class
